package com.ruoyi.project.drugs.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.drugs.domain.Drug;
import com.ruoyi.project.drugs.service.DrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/drugs/drug")
public class DrugController extends BaseController {
    @Autowired
    private DrugService drugService;

    @PreAuthorize("@ss.hasPermi('drugs:drug:list')")
    @GetMapping("/list")
    public TableDataInfo selDrug(String postCode,String postName){
        startPage();
        List<Drug> drugs = drugService.selDrugInfoService(postCode, postName);
        return getDataTable(drugs);
    }
}
